package com.feel.common;


import cn.dev33.satoken.exception.NotLoginException;
import com.feel.common.constant.HttpStatus;
import com.feel.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class SecurityException {

    @ExceptionHandler(NotLoginException.class)
    public R handlerCommonException(NotLoginException e) {
        log.error(e.getMessage(), e);
        return R.error(HttpStatus.FORBIDDEN, "用户未登录");
    }
}
